package com.carsystem.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.swiftdao.entity.KeyedPersistable;
/**
 * @author JinLiang
 * @datetime 2013-1-15 下午10:39:15
 * @describe 用户实体类
 */
@SuppressWarnings("serial")
@Entity
@Table(name="CS_USER")
public class UserEntity implements KeyedPersistable<Long> {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="userId")
	private Long id;
	@Column(nullable=false,unique=true,length=20)
	private String userName;
	@Column(nullable=false,length=20)
	private String userPassword;
	@Column(length=20)
	private String userRealName;
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="roleId")
	private RoleEntity roleEntity;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserPassword() {
		return userPassword;
	}
	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}
	public String getUserRealName() {
		return userRealName;
	}
	public void setUserRealName(String userRealName) {
		this.userRealName = userRealName;
	}
	public RoleEntity getRoleEntity() {
		return roleEntity;
	}
	public void setRoleEntity(RoleEntity roleEntity) {
		this.roleEntity = roleEntity;
	}
	public UserEntity(Long id, String userName, String userPassword,
			String userRealName) {
		super();
		this.id = id;
		this.userName = userName;
		this.userPassword = userPassword;
		this.userRealName = userRealName;
	}
	public UserEntity() {
		super();
		// TODO Auto-generated constructor stub
	}
}
